Imported from wildflowerhealthio/Wildflower (
slices/file-formats/http-archive/AGENTS.md). Install upstream withnpx skills add wildflowerhealthio/Wildflower --skill http-archive. Copyright stays with the author.
AGENTS.md — slices/file-formats/http-archive
The HTTP Archive format (HAR 1.2), as one schema read in both directions —
the neutral decode seam below both the importer (which parses an archive into
FHIR) and the anonymizer (which redacts one). No DOM, no fs, no React.
Moved out of har-importer-core/har (the old /har subpath) into the
file-formats slice so both consumers depend down into it, rather than the
anonymizer reaching sideways into the importer.
Shape
src/har.ts— the HAR 1.2 format (Har,HarFromJson,HarLog,HarPage,HarEntry,HarResponse,HarTimings,HarBodyand friends,NOT_MEASURED), held to the published spec byhar-schemacompiled throughajv. Fields the spec requires default when absent (-1for an unmeasured number); fields it leaves optional (pages,pageref,serverIPAddress,connection, theblocked/dns/connect/sslphases,pageTimings) stay optional. Unknown keys are ignored, so the_-prefixed vendor extras of a DevTools export are dropped on decode.src/chrome-har.ts—ChromeHar: the same format with the Chrome DevTools entry extras declared (ChromeHarEntryadds_initiator,_priority,_resourceType;ChromeHarLog,ChromeHarFromJson,chromeHarToJson/chromeHarFromJson), so a producer or reader of a Chrome-shaped archive keeps them. Kept off the base schemas because they are one browser's extension, not the format. AChromeHaris structurally aHar; writing one throughharToJsondrops the extras.src/emit.ts—emitHar/emitHarFromLog: build an archive from capturedTraceExchangees or from anHttpArchive.Log, plus the comment constants that annotate what an import did not carry through (DROPPED_REQUEST_ON_IMPORT_COMMENT, etc.).emitHarFromLogserves more than one producer, socreatorNameandrequestCommentare options — the HAR recorder names itself and states that its request side was never observed, while the anonymizer takes the defaults (CREATOR_NAME,DROPPED_REQUEST_ON_IMPORT_COMMENT). AlsoharToJson/harFromJson(the.harfile text;{ pretty: true }indents two spaces as DevTools does) andqueryStringOf(a URL's parameters asrequest.queryString).src/http-archive.ts— theHttpArchiveprojection an importer and a replay consume (Entry,Log,LogFromHarJson): the response half of each archived exchange, a schema in both directions.src/index.ts— re-exports the four modules; the package root is what was thehar-importer-core/harsubpath.
Layering
Pure and neutral (platform: 'neutral'). Depends on effect,
browser-sniffer-core (HeadersWire), http-extraction-fundamentals
(HarMethodValueSchema, isHttpMethod), and — transitionally, until #578
dissolves slices/web-trace — web-trace-core (TraceExchange,
contentTypeOf, noTimings). ajv + har-schema are bundled. Never imports
har-importer-core, any *-anonymizer-*, a React package, or fhir-r4.
Testing
http-archive.test.ts— the projection round-trips throughLogFromHarJson; a foreign archive decodes to the response half it observed.emit.test.ts— an emitted archive validates against the HAR spec and round-trips the exchanges it was built from; one carrying pages,pageref,serverIPAddressand every timing phase validates and round-trips too;harToJsonwrites compact or pretty text of the same archive.chrome-har.test.ts— aChromeHarround-trips pages,pagerefand the DevTools extras through its file text; the baseHarreads the same export with only the extras dropped.
References
- slices/file-formats AGENTS.md — the slice's role and layering.
- har-importer-core AGENTS.md — the
importer binding that decodes through
HttpArchive.LogFromHarJson. - har-anonymizer-core AGENTS.md
— the redactor that walks an
HttpArchive.Log. - web-trace-core AGENTS.md — the
TraceExchangevocabulary this format is built on (slated for dissolution). - Doc Comments Reference — TSDoc conventions the modules here follow.
