@aperant/framework 0.8.4 → 0.8.6
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/CHANGELOG.md +156 -0
- package/agents/apt-planner.md +34 -3
- package/dist/cli/commands/coverage-check.d.mts.map +1 -1
- package/dist/cli/commands/coverage-check.mjs +74 -7
- package/dist/cli/commands/coverage-check.mjs.map +1 -1
- package/dist/cli/commands/detect-runtime.d.mts.map +1 -1
- package/dist/cli/commands/detect-runtime.mjs +18 -12
- package/dist/cli/commands/detect-runtime.mjs.map +1 -1
- package/dist/cli/coverage-check/user-outcomes.d.mts +84 -0
- package/dist/cli/coverage-check/user-outcomes.d.mts.map +1 -0
- package/dist/cli/coverage-check/user-outcomes.mjs +265 -0
- package/dist/cli/coverage-check/user-outcomes.mjs.map +1 -0
- package/dist/cli/host/detect.mjs +1 -1
- package/dist/cli/host/detect.mjs.map +1 -1
- package/dist/cli/install/install-from-source.mjs +3 -3
- package/dist/cli/install/legacy-paths.d.mts.map +1 -1
- package/dist/cli/install/legacy-paths.mjs +2 -0
- package/dist/cli/install/legacy-paths.mjs.map +1 -1
- package/dist/cli/verify-proof/idl/index.d.mts +1 -1
- package/dist/cli/verify-proof/idl/index.mjs +7 -8
- package/dist/cli/verify-proof/idl/index.mjs.map +1 -1
- package/dist/cli/verify-proof/idl/types.d.ts +5 -4
- package/dist/cli/verify-proof/idl/types.d.ts.map +1 -1
- package/dist/cli/verify-proof/idl/types.js +4 -3
- package/dist/cli/verify-proof/idl/types.js.map +1 -1
- package/dist/cli/verify-proof/resolver.d.mts +63 -1
- package/dist/cli/verify-proof/resolver.d.mts.map +1 -1
- package/dist/cli/verify-proof/resolver.mjs +164 -4
- package/dist/cli/verify-proof/resolver.mjs.map +1 -1
- package/dist/cli/verify-proof/runtime-detect.d.mts +6 -3
- package/dist/cli/verify-proof/runtime-detect.d.mts.map +1 -1
- package/dist/cli/verify-proof/runtime-detect.mjs +104 -11
- package/dist/cli/verify-proof/runtime-detect.mjs.map +1 -1
- package/dist/cli/verify-proof/trust.d.mts +1 -1
- package/dist/cli/verify-proof/trust.d.mts.map +1 -1
- package/dist/cli/verify-proof/trust.mjs +1 -1
- package/dist/driver-sdk/conformance.d.ts +41 -0
- package/dist/driver-sdk/conformance.d.ts.map +1 -0
- package/dist/driver-sdk/conformance.js +123 -0
- package/dist/driver-sdk/conformance.js.map +1 -0
- package/dist/driver-sdk/errors.d.ts +75 -0
- package/dist/driver-sdk/errors.d.ts.map +1 -0
- package/dist/driver-sdk/errors.js +80 -0
- package/dist/driver-sdk/errors.js.map +1 -0
- package/dist/driver-sdk/idl.d.ts +221 -0
- package/dist/driver-sdk/idl.d.ts.map +1 -0
- package/dist/driver-sdk/idl.js +140 -0
- package/dist/driver-sdk/idl.js.map +1 -0
- package/dist/driver-sdk/index.d.ts +28 -0
- package/dist/driver-sdk/index.d.ts.map +1 -0
- package/dist/driver-sdk/index.js +28 -0
- package/dist/driver-sdk/index.js.map +1 -0
- package/dist/driver-sdk/manifest.d.ts +93 -0
- package/dist/driver-sdk/manifest.d.ts.map +1 -0
- package/dist/driver-sdk/manifest.js +12 -0
- package/dist/driver-sdk/manifest.js.map +1 -0
- package/dist/driver-sdk/retry.d.ts +33 -0
- package/dist/driver-sdk/retry.d.ts.map +1 -0
- package/dist/driver-sdk/retry.js +50 -0
- package/dist/driver-sdk/retry.js.map +1 -0
- package/dist/plugin/.claude-plugin/plugin.json +2 -1
- package/dist/plugin/agents/apt-planner.md +34 -3
- package/dist/plugin/skills/apt-plan/SKILL.md +50 -0
- package/dist/plugin/skills/apt-pr-review/SKILL.md +1 -1
- package/dist/plugin/skills/apt-research/SKILL.md +526 -0
- package/dist/plugin/skills/apt-research/appendices/budget-loop.md +397 -0
- package/dist/plugin/skills/apt-research/appendices/claim-graph-schema.md +206 -0
- package/dist/plugin/skills/apt-research/appendices/domain-tools.md +236 -0
- package/dist/plugin/skills/apt-spar/SKILL.md +19 -7
- package/dist/plugin/skills/apt-verify-proof/SKILL.md +41 -2
- package/dist/schemas/quick-task.d.ts +17 -17
- package/drivers/.gitkeep +0 -0
- package/drivers/api/README.md +40 -0
- package/drivers/api/driver.mjs +59 -0
- package/drivers/api/manifest.json +26 -0
- package/drivers/browser/README.md +105 -0
- package/drivers/browser/driver.mjs +134 -0
- package/drivers/browser/manifest.json +35 -0
- package/drivers/cli/README.md +44 -0
- package/drivers/cli/driver.mjs +62 -0
- package/drivers/cli/manifest.json +28 -0
- package/drivers/electron/README.md +64 -0
- package/drivers/electron/driver.mjs +87 -0
- package/drivers/electron/manifest.json +37 -0
- package/package.json +7 -3
- package/skills/apt-plan/SKILL.md +50 -0
- package/skills/apt-planner.md +16 -0
- package/skills/apt-pr-review/SKILL.md +1 -1
- package/skills/apt-research/SKILL.md +526 -0
- package/skills/apt-research/appendices/budget-loop.md +397 -0
- package/skills/apt-research/appendices/claim-graph-schema.md +206 -0
- package/skills/apt-research/appendices/domain-tools.md +236 -0
- package/skills/apt-spar/SKILL.md +19 -7
- package/skills/apt-verify-proof/SKILL.md +41 -2
- package/src/cli/commands/coverage-check.mjs +126 -44
- package/src/cli/commands/detect-runtime.mjs +23 -14
- package/src/cli/coverage-check/user-outcomes.mjs +273 -0
- package/src/cli/host/detect.mjs +1 -1
- package/src/cli/install/install-from-source.mjs +3 -3
- package/src/cli/install/legacy-paths.mjs +2 -0
- package/src/cli/verify-proof/idl/index.mjs +7 -8
- package/src/cli/verify-proof/idl/types.ts +5 -4
- package/src/cli/verify-proof/manifest-schema.json +2 -1
- package/src/cli/verify-proof/resolver.mjs +171 -4
- package/src/cli/verify-proof/runtime-detect.mjs +99 -10
- package/src/cli/verify-proof/trust.mjs +1 -1
- package/templates/proof-verification.md +32 -3
- package/workflows/verify-proof.md +78 -9
|
@@ -16,10 +16,22 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Ties are broken by the next dimension; if every dimension is equal the
|
|
18
18
|
* driver with the lexicographically smaller driverId wins (deterministic).
|
|
19
|
+
*
|
|
20
|
+
* v0.8.6 — `resolveDriversForOutcomes(opts)` adds per-outcome driver
|
|
21
|
+
* dispatch for cross-surface specs (per spec §ID-03). It accepts the
|
|
22
|
+
* positional `outcomes[]` produced by `parseUserOutcomes` and returns
|
|
23
|
+
* `Array<{outcome_id, surface, driver}>` — one entry per
|
|
24
|
+
* (outcome, surface) pair. For `[electron+web]` outcomes it emits TWO
|
|
25
|
+
* entries with the same outcome_id and different drivers. The
|
|
26
|
+
* outcome_id field is passed through verbatim from parser → resolver
|
|
27
|
+
* → workflow runner with no name rewriting (the positional-ID
|
|
28
|
+
* contract).
|
|
29
|
+
*
|
|
30
|
+
* Existing `resolveDriver()` and `scoreDriver()` exports are unchanged.
|
|
19
31
|
*/
|
|
20
|
-
import { UnsatisfiedRequiredCapabilityError } from '@aperant/driver-sdk';
|
|
32
|
+
import { UnsatisfiedRequiredCapabilityError } from '@aperant/framework/driver-sdk';
|
|
21
33
|
/**
|
|
22
|
-
* @typedef {import('@aperant/driver-sdk').DriverManifest} DriverManifest
|
|
34
|
+
* @typedef {import('@aperant/framework/driver-sdk').DriverManifest} DriverManifest
|
|
23
35
|
* @typedef {import('./runtime-detect.mjs').RuntimeCapabilities} RuntimeCapabilities
|
|
24
36
|
*/
|
|
25
37
|
const STABILITY_RANK = { ga: 3, beta: 2, experimental: 1 };
|
|
@@ -133,8 +145,28 @@ export function resolveDriver(opts) {
|
|
|
133
145
|
}
|
|
134
146
|
stableOnly.push(d);
|
|
135
147
|
}
|
|
136
|
-
//
|
|
137
|
-
|
|
148
|
+
// Override is hard precedence (per opts.override docstring "explicit
|
|
149
|
+
// driverId precedence"): when set, try override-listed drivers in
|
|
150
|
+
// override order — the first one that satisfies every required
|
|
151
|
+
// capability wins, regardless of compatibility/priority/stability
|
|
152
|
+
// ranking. Non-matching override entries land in fallback. Only when
|
|
153
|
+
// every override entry misses a required cap do we fall through to
|
|
154
|
+
// score-based pick on the remaining drivers.
|
|
155
|
+
const overrideListed = stableOnly.filter((m) => overrideSet.has(m.driverId));
|
|
156
|
+
for (const candidate of overrideListed) {
|
|
157
|
+
const caps = new Set(candidate.capabilities ?? []);
|
|
158
|
+
const missing = required.filter((c) => !caps.has(c));
|
|
159
|
+
if (missing.length === 0) {
|
|
160
|
+
return { selected: candidate, fallback_attempts: fallback };
|
|
161
|
+
}
|
|
162
|
+
fallback.push({
|
|
163
|
+
driver_id: candidate.driverId,
|
|
164
|
+
reason: `override-listed but missing required capabilities: ${missing.join(', ')}`,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// Score every non-override survivor against required capabilities.
|
|
168
|
+
const nonOverride = stableOnly.filter((m) => !overrideSet.has(m.driverId));
|
|
169
|
+
const scored = nonOverride.map((m) => ({ manifest: m, ...scoreDriver(m, runtime, required) }));
|
|
138
170
|
// Sort highest-first, tie-break on driverId for determinism.
|
|
139
171
|
scored.sort((a, b) => {
|
|
140
172
|
const cmp = compareScores(a.score, b.score);
|
|
@@ -157,4 +189,132 @@ export function resolveDriver(opts) {
|
|
|
157
189
|
// Exhausted the chain — fail closed (ID-02).
|
|
158
190
|
throw new UnsatisfiedRequiredCapabilityError(`No driver in the chain satisfies every required capability: [${required.join(', ')}]`, required[0], fallback);
|
|
159
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Map a User Outcomes surface tag to the runtime-capability flag a driver
|
|
194
|
+
* must carry (via `matchesRuntime`) to be eligible for that surface.
|
|
195
|
+
*
|
|
196
|
+
* Closed surface set: `electron | web | cli | api | electron+web`.
|
|
197
|
+
* `electron+web` is NOT a single flag — it's a cross-surface tag the
|
|
198
|
+
* workflow runner expands into two single-surface dispatches.
|
|
199
|
+
*
|
|
200
|
+
* @param {('electron'|'web'|'cli'|'api')} surface
|
|
201
|
+
* @returns {('is_electron'|'is_web_frontend'|'has_node')}
|
|
202
|
+
*/
|
|
203
|
+
export function surfaceToRequiredFlag(surface) {
|
|
204
|
+
switch (surface) {
|
|
205
|
+
case 'electron':
|
|
206
|
+
return 'is_electron';
|
|
207
|
+
case 'web':
|
|
208
|
+
return 'is_web_frontend';
|
|
209
|
+
case 'cli':
|
|
210
|
+
case 'api':
|
|
211
|
+
return 'has_node';
|
|
212
|
+
default:
|
|
213
|
+
throw new Error(`surfaceToRequiredFlag: unknown surface "${surface}"`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Resolve a driver per outcome surface tag, NOT per verify-proof run
|
|
218
|
+
* (per spec §ID-03). For each input outcome the function returns one
|
|
219
|
+
* `{outcome_id, surface, driver}` entry; for `[electron+web]` outcomes
|
|
220
|
+
* it returns TWO entries (electron + web) sharing the same outcome_id.
|
|
221
|
+
*
|
|
222
|
+
* The `outcome_id` field on each returned entry is the positional ID
|
|
223
|
+
* produced by `parseUserOutcomes` (e.g. `O1`, `O2`). The resolver does
|
|
224
|
+
* NOT rewrite or regenerate IDs — they pass through verbatim so the
|
|
225
|
+
* workflow runner can correlate proof artifacts to spec lines.
|
|
226
|
+
*
|
|
227
|
+
* Each per-surface dispatch synthesizes a runtime-capabilities view
|
|
228
|
+
* that ONLY claims the surface's required flag (e.g. `is_electron`
|
|
229
|
+
* alone for an electron-surface outcome, even when the project also
|
|
230
|
+
* carries `is_web_frontend`). This forces the existing scoring to
|
|
231
|
+
* pick the per-surface driver — without it, a project with BOTH
|
|
232
|
+
* electron AND web capabilities would always select the highest-
|
|
233
|
+
* priority bundled driver (currently `browser`) for every outcome.
|
|
234
|
+
*
|
|
235
|
+
* Delegates to the existing `resolveDriver()` for the actual scoring
|
|
236
|
+
* — the scoring code stays in one place.
|
|
237
|
+
*
|
|
238
|
+
* @param {Object} opts
|
|
239
|
+
* @param {DriverManifest[]} opts.drivers
|
|
240
|
+
* @param {RuntimeCapabilities} opts.runtime
|
|
241
|
+
* @param {Array<{id: string, surface: 'electron'|'web'|'cli'|'api'|'electron+web'}>} opts.outcomes
|
|
242
|
+
* @param {string[]} [opts.override]
|
|
243
|
+
* @param {string[]} [opts.required_stability]
|
|
244
|
+
* @param {string[]} [opts.required_capabilities] — defaults to ['screenshot']
|
|
245
|
+
* @returns {Array<{outcome_id: string, surface: string, driver: DriverManifest, fallback_attempts: Array<{driver_id: string, reason: string}>}>}
|
|
246
|
+
*/
|
|
247
|
+
export function resolveDriversForOutcomes(opts) {
|
|
248
|
+
const drivers = opts.drivers ?? [];
|
|
249
|
+
const runtime = opts.runtime;
|
|
250
|
+
const outcomes = opts.outcomes ?? [];
|
|
251
|
+
const required = opts.required_capabilities ?? ['screenshot'];
|
|
252
|
+
const override = opts.override;
|
|
253
|
+
const stability = opts.required_stability;
|
|
254
|
+
/** @type {Array<{outcome_id: string, surface: string, driver: DriverManifest, fallback_attempts: Array<{driver_id: string, reason: string}>}>} */
|
|
255
|
+
const results = [];
|
|
256
|
+
for (const outcome of outcomes) {
|
|
257
|
+
const surfacesToDispatch = outcome.surface === 'electron+web' ? ['electron', 'web'] : [outcome.surface];
|
|
258
|
+
for (const surface of surfacesToDispatch) {
|
|
259
|
+
const flag = surfaceToRequiredFlag(/** @type {'electron'|'web'|'cli'|'api'} */ (surface));
|
|
260
|
+
// Synthesize a per-surface runtime view: only the surface's
|
|
261
|
+
// required flag is on; every other flag is masked off so the
|
|
262
|
+
// scoring prefers per-surface drivers (otherwise, on a
|
|
263
|
+
// multi-runtime project, the highest-priority bundled driver
|
|
264
|
+
// always wins). `has_node` stays on for cli/api since multiple
|
|
265
|
+
// drivers may target node.
|
|
266
|
+
const surfaceRuntime = maskRuntimeForSurface(runtime, flag);
|
|
267
|
+
const resolved = resolveDriver({
|
|
268
|
+
drivers,
|
|
269
|
+
runtime: surfaceRuntime,
|
|
270
|
+
required_capabilities: required,
|
|
271
|
+
...(override ? { override } : {}),
|
|
272
|
+
...(stability ? { required_stability: stability } : {}),
|
|
273
|
+
});
|
|
274
|
+
results.push({
|
|
275
|
+
outcome_id: outcome.id,
|
|
276
|
+
surface,
|
|
277
|
+
driver: resolved.selected,
|
|
278
|
+
fallback_attempts: resolved.fallback_attempts,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return results;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Return a copy of `runtime` with every flag false EXCEPT the one named
|
|
286
|
+
* by `flag`. Used to scope the resolver's compatibility check to a
|
|
287
|
+
* single surface during per-outcome dispatch.
|
|
288
|
+
*
|
|
289
|
+
* @param {RuntimeCapabilities} runtime
|
|
290
|
+
* @param {string} flag — one of: is_electron | is_web_frontend | has_node
|
|
291
|
+
* @returns {RuntimeCapabilities}
|
|
292
|
+
*/
|
|
293
|
+
function maskRuntimeForSurface(runtime, flag) {
|
|
294
|
+
/** @type {RuntimeCapabilities} */
|
|
295
|
+
const masked = {
|
|
296
|
+
is_electron: false,
|
|
297
|
+
is_tauri: false,
|
|
298
|
+
is_nextjs: false,
|
|
299
|
+
is_nuxt: false,
|
|
300
|
+
is_web_frontend: false,
|
|
301
|
+
is_expo: false,
|
|
302
|
+
is_react_native: false,
|
|
303
|
+
has_node: false,
|
|
304
|
+
};
|
|
305
|
+
// Only flip the surface's flag on if the project actually carries it
|
|
306
|
+
// (otherwise the resolver should genuinely fail — fail-closed).
|
|
307
|
+
if (flag === 'is_electron' && runtime.is_electron)
|
|
308
|
+
masked.is_electron = true;
|
|
309
|
+
if (flag === 'is_web_frontend' && runtime.is_web_frontend) {
|
|
310
|
+
masked.is_web_frontend = true;
|
|
311
|
+
// Carry the framework hint too (Next.js / Nuxt) so drivers that
|
|
312
|
+
// target browser via those frameworks still match.
|
|
313
|
+
masked.is_nextjs = runtime.is_nextjs;
|
|
314
|
+
masked.is_nuxt = runtime.is_nuxt;
|
|
315
|
+
}
|
|
316
|
+
if (flag === 'has_node')
|
|
317
|
+
masked.has_node = runtime.has_node;
|
|
318
|
+
return masked;
|
|
319
|
+
}
|
|
160
320
|
//# sourceMappingURL=resolver.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.mjs","sourceRoot":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;AAED;;;;;;;;GAQG;AACH,SAAS,qBAAqB,CAAC,OAAO,EAAE,IAAI;IAC3C,kCAAkC;IAClC,MAAM,MAAM,GAAG;QACd,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,KAAK;QACtB,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,KAAK;QACtB,QAAQ,EAAE,KAAK;KACf,CAAA;IACD,qEAAqE;IACrE,gEAAgE;IAChE,IAAI,IAAI,KAAK,aAAa,IAAI,OAAO,CAAC,WAAW;QAAE,MAAM,CAAC,WAAW,GAAG,IAAI,CAAA;IAC5E,IAAI,IAAI,KAAK,iBAAiB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC3D,MAAM,CAAC,eAAe,GAAG,IAAI,CAAA;QAC7B,gEAAgE;QAChE,mDAAmD;QACnD,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACpC,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IACjC,CAAC;IACD,IAAI,IAAI,KAAK,UAAU;QAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAC3D,OAAO,MAAM,CAAA;AACd,CAAC"}
|
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
export function detectFromPackageJson(packageJson: Record<string, unknown> | null): RuntimeCapabilities;
|
|
8
8
|
/**
|
|
9
9
|
* Load and detect capabilities from a project directory's package.json.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* v0.8.6 — also walks `monorepo_globs` (default `['apps/*']`) and
|
|
11
|
+
* OR-merges each match's capabilities with the root.
|
|
12
12
|
*
|
|
13
13
|
* @param {string} projectDir
|
|
14
|
+
* @param {{monorepo_globs?: string[]}} [opts]
|
|
14
15
|
* @returns {RuntimeCapabilities}
|
|
15
16
|
*/
|
|
16
|
-
export function loadRuntimeCapabilities(projectDir: string
|
|
17
|
+
export function loadRuntimeCapabilities(projectDir: string, opts?: {
|
|
18
|
+
monorepo_globs?: string[];
|
|
19
|
+
}): RuntimeCapabilities;
|
|
17
20
|
export type RuntimeCapabilities = {
|
|
18
21
|
is_electron: boolean;
|
|
19
22
|
is_tauri: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-detect.d.mts","sourceRoot":"","sources":["../../../src/cli/verify-proof/runtime-detect.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-detect.d.mts","sourceRoot":"","sources":["../../../src/cli/verify-proof/runtime-detect.mjs"],"names":[],"mappings":"AAiDA;;;;;GAKG;AACH,mDAHW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAC5B,mBAAmB,CAwD/B;AAED;;;;;;;;GAQG;AACH,oDAJW,MAAM,SACN;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GACzB,mBAAmB,CAkC/B;;iBA/Ha,OAAO;cACP,OAAO;eACP,OAAO;aACP,OAAO;qBACP,OAAO;aACP,OAAO;qBACP,OAAO;cACP,OAAO"}
|
|
@@ -8,8 +8,16 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Pattern: pure data in → pure data out. No filesystem walking, no exec.
|
|
10
10
|
* Use loadRuntimeCapabilities(projectDir) for the cwd-rooted variant.
|
|
11
|
+
*
|
|
12
|
+
* v0.8.6 — `loadRuntimeCapabilities` now ALSO walks `apps/*` by default
|
|
13
|
+
* (configurable via the second arg `{monorepo_globs}`) and OR-merges
|
|
14
|
+
* each match's `package.json` capabilities with the root. The default
|
|
15
|
+
* `['apps/*']` matches the canonical Aperant monorepo layout; adopters
|
|
16
|
+
* whose monorepo lives elsewhere (e.g. `packages/apps/*`) pass a
|
|
17
|
+
* custom `monorepo_globs`. Setting `monorepo_globs: []` disables the
|
|
18
|
+
* walk entirely (root-only escape hatch).
|
|
11
19
|
*/
|
|
12
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
20
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
13
21
|
import { join, resolve } from 'node:path';
|
|
14
22
|
/**
|
|
15
23
|
* @typedef {Object} RuntimeCapabilities
|
|
@@ -94,23 +102,108 @@ export function detectFromPackageJson(packageJson) {
|
|
|
94
102
|
}
|
|
95
103
|
/**
|
|
96
104
|
* Load and detect capabilities from a project directory's package.json.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
105
|
+
* v0.8.6 — also walks `monorepo_globs` (default `['apps/*']`) and
|
|
106
|
+
* OR-merges each match's capabilities with the root.
|
|
99
107
|
*
|
|
100
108
|
* @param {string} projectDir
|
|
109
|
+
* @param {{monorepo_globs?: string[]}} [opts]
|
|
101
110
|
* @returns {RuntimeCapabilities}
|
|
102
111
|
*/
|
|
103
|
-
export function loadRuntimeCapabilities(projectDir) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
export function loadRuntimeCapabilities(projectDir, opts) {
|
|
113
|
+
const root = resolve(projectDir);
|
|
114
|
+
const rootPkgPath = join(root, 'package.json');
|
|
115
|
+
let rootCaps = emptyCapabilities();
|
|
116
|
+
if (existsSync(rootPkgPath)) {
|
|
117
|
+
try {
|
|
118
|
+
rootCaps = detectFromPackageJson(JSON.parse(readFileSync(rootPkgPath, 'utf-8')));
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
/* fall through with empty caps */
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Default to the canonical Aperant monorepo layout. Passing `[]`
|
|
125
|
+
// disables the walk entirely (root-only escape hatch per spec ID-05).
|
|
126
|
+
const globs = opts && Array.isArray(opts.monorepo_globs) ? opts.monorepo_globs : ['apps/*'];
|
|
127
|
+
if (globs.length === 0)
|
|
128
|
+
return rootCaps;
|
|
129
|
+
let merged = rootCaps;
|
|
130
|
+
for (const glob of globs) {
|
|
131
|
+
const matches = expandSimpleGlob(root, glob);
|
|
132
|
+
for (const dir of matches) {
|
|
133
|
+
const childPkgPath = join(dir, 'package.json');
|
|
134
|
+
if (!existsSync(childPkgPath))
|
|
135
|
+
continue;
|
|
136
|
+
try {
|
|
137
|
+
const childCaps = detectFromPackageJson(JSON.parse(readFileSync(childPkgPath, 'utf-8')));
|
|
138
|
+
merged = orMergeCapabilities(merged, childCaps);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
/* skip malformed package.json */
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return merged;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Expand a simple `prefix/*` glob against the root. Supports ONLY the
|
|
149
|
+
* `<dir>/*` shape (matches each direct subdirectory of `<dir>`). Other
|
|
150
|
+
* glob syntax is intentionally rejected — v1 keeps the dep surface
|
|
151
|
+
* small. Fails closed on malformed patterns (returns []).
|
|
152
|
+
*
|
|
153
|
+
* @param {string} root
|
|
154
|
+
* @param {string} glob
|
|
155
|
+
* @returns {string[]}
|
|
156
|
+
*/
|
|
157
|
+
function expandSimpleGlob(root, glob) {
|
|
158
|
+
if (typeof glob !== 'string' || !glob.endsWith('/*'))
|
|
159
|
+
return [];
|
|
160
|
+
const prefix = glob.slice(0, -2);
|
|
161
|
+
if (prefix.length === 0 || prefix.includes('*'))
|
|
162
|
+
return [];
|
|
163
|
+
const dir = join(root, prefix);
|
|
164
|
+
if (!existsSync(dir))
|
|
165
|
+
return [];
|
|
166
|
+
let entries;
|
|
108
167
|
try {
|
|
109
|
-
|
|
168
|
+
entries = readdirSync(dir);
|
|
110
169
|
}
|
|
111
170
|
catch {
|
|
112
|
-
return
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
const matches = [];
|
|
174
|
+
for (const name of entries) {
|
|
175
|
+
const sub = join(dir, name);
|
|
176
|
+
try {
|
|
177
|
+
if (statSync(sub).isDirectory())
|
|
178
|
+
matches.push(sub);
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
/* skip unreadable entries */
|
|
182
|
+
}
|
|
113
183
|
}
|
|
114
|
-
return
|
|
184
|
+
return matches;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Boolean OR-merge of two capability records. Any flag true in either
|
|
188
|
+
* input is true in the output. The "Electron wins over web" rule from
|
|
189
|
+
* `detectFromPackageJson` is preserved when this is called repeatedly —
|
|
190
|
+
* each child's flags are honest about that child's own shape, and the
|
|
191
|
+
* OR-merge just unions them.
|
|
192
|
+
*
|
|
193
|
+
* @param {RuntimeCapabilities} a
|
|
194
|
+
* @param {RuntimeCapabilities} b
|
|
195
|
+
* @returns {RuntimeCapabilities}
|
|
196
|
+
*/
|
|
197
|
+
function orMergeCapabilities(a, b) {
|
|
198
|
+
return {
|
|
199
|
+
is_electron: a.is_electron || b.is_electron,
|
|
200
|
+
is_tauri: a.is_tauri || b.is_tauri,
|
|
201
|
+
is_nextjs: a.is_nextjs || b.is_nextjs,
|
|
202
|
+
is_nuxt: a.is_nuxt || b.is_nuxt,
|
|
203
|
+
is_web_frontend: a.is_web_frontend || b.is_web_frontend,
|
|
204
|
+
is_expo: a.is_expo || b.is_expo,
|
|
205
|
+
is_react_native: a.is_react_native || b.is_react_native,
|
|
206
|
+
has_node: a.has_node || b.has_node,
|
|
207
|
+
};
|
|
115
208
|
}
|
|
116
209
|
//# sourceMappingURL=runtime-detect.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-detect.mjs","sourceRoot":"","sources":["../../../src/cli/verify-proof/runtime-detect.mjs"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runtime-detect.mjs","sourceRoot":"","sources":["../../../src/cli/verify-proof/runtime-detect.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO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CAAA;QAC3B,IAAI,CAAC;YACJ,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;gBAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACnD,CAAC;QAAC,MAAM,CAAC;YACR,6BAA6B;QAC9B,CAAC;IACF,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,mBAAmB,CAAC,CAAC,EAAE,CAAC;IAChC,OAAO;QACN,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW;QAC3C,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ;QAClC,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS;QACrC,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO;QAC/B,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,eAAe;QACvD,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO;QAC/B,eAAe,EAAE,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,eAAe;QACvD,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ;KAClC,CAAA;AACF,CAAC"}
|
|
@@ -66,5 +66,5 @@ export function decide(manifest: DriverManifest, tofu: ReturnType<typeof readTof
|
|
|
66
66
|
* @param {DriverManifest} manifest
|
|
67
67
|
*/
|
|
68
68
|
export function recordApproval(projectDir: string, manifest: DriverManifest): void;
|
|
69
|
-
export type DriverManifest = import("@aperant/driver-sdk").DriverManifest;
|
|
69
|
+
export type DriverManifest = import("@aperant/framework/driver-sdk").DriverManifest;
|
|
70
70
|
//# sourceMappingURL=trust.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust.d.mts","sourceRoot":"","sources":["../../../src/cli/verify-proof/trust.mjs"],"names":[],"mappings":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AM,CAAA;CAAC,CAAC,CAUxH;AAED;;;;;;;;GAQG;AACH,0CAHW,MAAM,QACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAMjC;AAED;;;;;;;GAOG;AACH,kCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,uCAHW,MAAM,GACJ;IAAC,IAAI,EAAE,kBAAkB,GAAG,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAgBzF;AAED;;;;;;;GAOG;AACH,iCALW,cAAc,QACd,UAAU,CAAC,OAAO,YAAY,CAAC,UAC/B,UAAU,CAAC,OAAO,UAAU,CAAC,GAC3B;IAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAAC,CAwDjH;AAED;;;;;;;GAOG;AACH,2CAHW,MAAM,YACN,cAAc,QAYxB;6BAjKY,OAAO,+BAA+B,EAAE,cAAc"}
|
|
@@ -21,7 +21,7 @@ import { createHash } from 'node:crypto';
|
|
|
21
21
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
22
22
|
import { dirname, join, resolve } from 'node:path';
|
|
23
23
|
/**
|
|
24
|
-
* @typedef {import('@aperant/driver-sdk').DriverManifest} DriverManifest
|
|
24
|
+
* @typedef {import('@aperant/framework/driver-sdk').DriverManifest} DriverManifest
|
|
25
25
|
*/
|
|
26
26
|
const TOFU_PATH = '.aperant/driver-tofu.json';
|
|
27
27
|
const POLICY_PATH = '.aperant/policy.json';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* conformance.ts — shared conformance kit for driver authors + bundled drivers.
|
|
3
|
+
*
|
|
4
|
+
* `runConformanceKit({ manifest, driverModule })` returns a structured pass/fail
|
|
5
|
+
* report. Used by the four bundled drivers' tests (ST07–ST09). Re-exposed
|
|
6
|
+
* via the driver-sdk public surface for re-extraction readiness — see
|
|
7
|
+
* driver-sdk/index.ts header.
|
|
8
|
+
*
|
|
9
|
+
* Checks:
|
|
10
|
+
* 1. Every declared capability in manifest.capabilities[] has a matching
|
|
11
|
+
* function export on driverModule.
|
|
12
|
+
* 2. Every function export returns a VerbResult-shaped object when invoked
|
|
13
|
+
* with a dummy arg (status, evidence_paths, duration_ms, retry_count).
|
|
14
|
+
* 3. The manifest's transport field is structured (not a raw string).
|
|
15
|
+
* 4. The manifest's trust.tier is one of the four allowed values.
|
|
16
|
+
*/
|
|
17
|
+
import type { DriverModule } from './idl.js';
|
|
18
|
+
import type { DriverManifest } from './manifest.js';
|
|
19
|
+
export interface ConformanceCheck {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly status: 'pass' | 'fail';
|
|
23
|
+
readonly detail?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ConformanceReport {
|
|
26
|
+
readonly driver_id: string;
|
|
27
|
+
readonly version: string;
|
|
28
|
+
readonly overall: 'pass' | 'fail';
|
|
29
|
+
readonly checks: readonly ConformanceCheck[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run the conformance kit against a driver. Pass `dummyArgs` to control the
|
|
33
|
+
* fixture invocation; default is an empty object (most drivers ignore args
|
|
34
|
+
* in conformance mode and return a stub VerbResult).
|
|
35
|
+
*/
|
|
36
|
+
export declare function runConformanceKit(opts: {
|
|
37
|
+
manifest: DriverManifest;
|
|
38
|
+
driverModule: DriverModule;
|
|
39
|
+
dummyArgs?: Record<string, unknown>;
|
|
40
|
+
}): Promise<ConformanceReport>;
|
|
41
|
+
//# sourceMappingURL=conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/driver-sdk/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAC5C;AA2BD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC7C,QAAQ,EAAE,cAAc,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA8E7B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* conformance.ts — shared conformance kit for driver authors + bundled drivers.
|
|
3
|
+
*
|
|
4
|
+
* `runConformanceKit({ manifest, driverModule })` returns a structured pass/fail
|
|
5
|
+
* report. Used by the four bundled drivers' tests (ST07–ST09). Re-exposed
|
|
6
|
+
* via the driver-sdk public surface for re-extraction readiness — see
|
|
7
|
+
* driver-sdk/index.ts header.
|
|
8
|
+
*
|
|
9
|
+
* Checks:
|
|
10
|
+
* 1. Every declared capability in manifest.capabilities[] has a matching
|
|
11
|
+
* function export on driverModule.
|
|
12
|
+
* 2. Every function export returns a VerbResult-shaped object when invoked
|
|
13
|
+
* with a dummy arg (status, evidence_paths, duration_ms, retry_count).
|
|
14
|
+
* 3. The manifest's transport field is structured (not a raw string).
|
|
15
|
+
* 4. The manifest's trust.tier is one of the four allowed values.
|
|
16
|
+
*/
|
|
17
|
+
import { isVerbResult } from './idl.js';
|
|
18
|
+
const ALLOWED_TRUST_TIERS = new Set([
|
|
19
|
+
'first_party_signed',
|
|
20
|
+
'community_verified',
|
|
21
|
+
'community_unverified',
|
|
22
|
+
'local_unverified',
|
|
23
|
+
]);
|
|
24
|
+
function isStructuredTransport(t) {
|
|
25
|
+
if (t === null || typeof t !== 'object' || Array.isArray(t))
|
|
26
|
+
return false;
|
|
27
|
+
const obj = t;
|
|
28
|
+
if (typeof obj.mcp_server_id === 'string')
|
|
29
|
+
return true;
|
|
30
|
+
if (typeof obj.http_endpoint === 'string')
|
|
31
|
+
return true;
|
|
32
|
+
if (typeof obj.npm_package === 'string')
|
|
33
|
+
return true;
|
|
34
|
+
if (obj.builtin === true)
|
|
35
|
+
return true;
|
|
36
|
+
if (obj.local_command !== null &&
|
|
37
|
+
typeof obj.local_command === 'object' &&
|
|
38
|
+
!Array.isArray(obj.local_command)) {
|
|
39
|
+
const lc = obj.local_command;
|
|
40
|
+
return typeof lc.binary === 'string' && Array.isArray(lc.args);
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Run the conformance kit against a driver. Pass `dummyArgs` to control the
|
|
46
|
+
* fixture invocation; default is an empty object (most drivers ignore args
|
|
47
|
+
* in conformance mode and return a stub VerbResult).
|
|
48
|
+
*/
|
|
49
|
+
export async function runConformanceKit(opts) {
|
|
50
|
+
const { manifest, driverModule } = opts;
|
|
51
|
+
const dummyArgs = opts.dummyArgs ?? { target: { kind: 'css', value: '#stub' } };
|
|
52
|
+
const checks = [];
|
|
53
|
+
// Check 1: structured transport
|
|
54
|
+
checks.push({
|
|
55
|
+
id: 'transport-structured',
|
|
56
|
+
description: 'manifest.transport must be a structured oneOf, never a raw string',
|
|
57
|
+
status: isStructuredTransport(manifest.transport) ? 'pass' : 'fail',
|
|
58
|
+
detail: isStructuredTransport(manifest.transport)
|
|
59
|
+
? undefined
|
|
60
|
+
: `transport is not a structured variant: ${JSON.stringify(manifest.transport)}`,
|
|
61
|
+
});
|
|
62
|
+
// Check 2: trust tier is one of the four allowed
|
|
63
|
+
checks.push({
|
|
64
|
+
id: 'trust-tier-allowed',
|
|
65
|
+
description: 'manifest.trust.tier must be one of the four allowed values',
|
|
66
|
+
status: ALLOWED_TRUST_TIERS.has(manifest.trust?.tier) ? 'pass' : 'fail',
|
|
67
|
+
detail: ALLOWED_TRUST_TIERS.has(manifest.trust?.tier)
|
|
68
|
+
? undefined
|
|
69
|
+
: `trust.tier="${manifest.trust?.tier}" not in ${[...ALLOWED_TRUST_TIERS].join(', ')}`,
|
|
70
|
+
});
|
|
71
|
+
// Check 3: capabilities length >= 5
|
|
72
|
+
checks.push({
|
|
73
|
+
id: 'capabilities-min-five',
|
|
74
|
+
description: 'manifest.capabilities must declare at least 5 IDL verbs',
|
|
75
|
+
status: manifest.capabilities.length >= 5 ? 'pass' : 'fail',
|
|
76
|
+
detail: manifest.capabilities.length >= 5
|
|
77
|
+
? undefined
|
|
78
|
+
: `only ${manifest.capabilities.length} capabilities declared`,
|
|
79
|
+
});
|
|
80
|
+
// Check 4: every declared capability has a function export
|
|
81
|
+
for (const cap of manifest.capabilities) {
|
|
82
|
+
const fn = driverModule[cap];
|
|
83
|
+
const ok = typeof fn === 'function';
|
|
84
|
+
checks.push({
|
|
85
|
+
id: `capability-export-${cap}`,
|
|
86
|
+
description: `manifest.capabilities[${cap}] has a matching function export`,
|
|
87
|
+
status: ok ? 'pass' : 'fail',
|
|
88
|
+
detail: ok ? undefined : `driverModule.${cap} is not a function`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Check 5: every declared capability returns a VerbResult shape
|
|
92
|
+
for (const cap of manifest.capabilities) {
|
|
93
|
+
const fn = driverModule[cap];
|
|
94
|
+
if (typeof fn !== 'function')
|
|
95
|
+
continue; // already failed Check 4
|
|
96
|
+
try {
|
|
97
|
+
const result = await fn(dummyArgs);
|
|
98
|
+
const ok = isVerbResult(result);
|
|
99
|
+
checks.push({
|
|
100
|
+
id: `capability-shape-${cap}`,
|
|
101
|
+
description: `driver.${cap}() returns a VerbResult shape`,
|
|
102
|
+
status: ok ? 'pass' : 'fail',
|
|
103
|
+
detail: ok ? undefined : `return shape: ${JSON.stringify(result)}`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
checks.push({
|
|
108
|
+
id: `capability-shape-${cap}`,
|
|
109
|
+
description: `driver.${cap}() returns a VerbResult shape`,
|
|
110
|
+
status: 'fail',
|
|
111
|
+
detail: `threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const overall = checks.every((c) => c.status === 'pass') ? 'pass' : 'fail';
|
|
116
|
+
return {
|
|
117
|
+
driver_id: manifest.driverId,
|
|
118
|
+
version: manifest.version,
|
|
119
|
+
overall,
|
|
120
|
+
checks,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/driver-sdk/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAiBvC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,oBAAoB;IACpB,oBAAoB;IACpB,sBAAsB;IACtB,kBAAkB;CAClB,CAAC,CAAA;AAEF,SAAS,qBAAqB,CAAC,CAAU;IACxC,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CA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